package com.fc.advbox.process.migrate.option;

/**
 * an option is a monad that is derived from Maybe in haskel which is a parameterized 
 * type which is used to better define null values. By using this you can define by your
 * type if something being returned has the potential of being null, instead of guessing
 * if the parameter MIGHT return null (i.e. it serves as a better contract than one written
 * in documentation) 
 * 
 * @param <T> the type of option this represents
 */
public interface Option<T> {

    /** 
     * @return the typed value
     */
    T get();
        
    /** 
     * if this is an instance of None the default value provided is returned, 
     * otherwise it returns this.
     * 
     * @return if this is an instance of None the default value provided is returned, 
     * otherwise it returns this
     */
    public T getOr(T value);
        
    /**
     * @return true if this is none
     */
    boolean isNone();
    
    /**
     * @return true if this option has a value
     */
    boolean hasValue();
}
